home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IOInterface / deltaTimer.dcl < prev    next >
Encoding:
Modula Definition  |  1995-02-24  |  1.7 KB  |  62 lines  |  [TEXT/3PRM]

  1. definition module deltaTimer;
  2.  
  3.  
  4. //    Version 0.8 to 1.0
  5.  
  6. //
  7. //    Operations on the TimerDevice. 
  8. //
  9.  
  10.  
  11. import    deltaIOSystem;
  12. from    ioState    import IOState;
  13.  
  14.  
  15. TicksPerSecond :== 60;
  16.  
  17.     
  18. ::    CurrentTime
  19.     :==    (    !Int,        // hours        (0-23)
  20.             !Int,        // minutes        (0-59)
  21.             !Int        // seconds        (0-59)
  22.         );
  23. ::    CurrentDate
  24.     :==    (    !Int,        // year
  25.             !Int,        // month        (1-12)
  26.             !Int,        // day            (1-31)
  27.             !Int        // day of week    (1-7, Sunday=1, Saturday=7)
  28.         );
  29.  
  30.  
  31. OpenTimer            :: !(TimerDef s (IOState s)) !(IOState s) -> IOState s;
  32. CloseTimer            :: !TimerId !(IOState s) -> IOState s;
  33.  
  34. /*    Opening and closing of timers. In case already a timer exists with the
  35.     given new TimerId, the timer is not opened. Closing the timer with an
  36.     unknown TimerId has no effect. */
  37.  
  38. EnableTimer            :: !TimerId !(IOState s) -> IOState s;
  39. DisableTimer        :: !TimerId !(IOState s) -> IOState s;
  40. ChangeTimerFunction    :: !TimerId !(TimerFunction s (IOState s))
  41.                                 !(IOState s) -> IOState s;
  42. SetTimerInterval    :: !TimerId !TimerInterval !(IOState s) -> IOState s;
  43.  
  44. /*    Enable, disable and change the TimerFunction and TimerInterval
  45.     of the TimerDevice. The TimerInterval must at least be zero.
  46.     Negative TimerIntervals are effectively set to zero. */
  47.  
  48. Wait                :: !TimerInterval x  -> x;
  49. UWait                :: !TimerInterval *x -> *x;
  50.  
  51. /*    Wait/UWait suspend the interaction for TimerInterval ticks. */
  52.  
  53. GetTimerBlinkInterval:: !(IOState s) -> (!TimerInterval, !IOState s);
  54.  
  55. /*    Returns the TimerInteval that should elaps between blinks of e.g.
  56.     a cursor. This interval can change during the interaction! */
  57.  
  58. GetCurrentTime        :: !(IOState s) -> (!CurrentTime, !IOState s);
  59. GetCurrentDate        :: !(IOState s) -> (!CurrentDate, !IOState s);
  60.  
  61. /*    GetCurrentTime and GetCurrentDate return the current time and date. */
  62.